define(['knockout', 'eventbus', 'bootstrap'], function (ko, eventbus) {
    return function () {
        // The selected component.
        let currentComponent = ko.observable("home");
        // All the menu items.
        let menuItems = ko.observableArray([
            { name: "Home", component: "home" },
            { name: "Search & History", component: "search-and-history" },
            { name: "Saved Questions", component: "saved-questions" },
            { name: "List Questions", component: "list-questions" },
            { name: "Word clouds", component: "word-clouds" },
            { name: "Login", component: "login" },
        ]);

        // The menu click callback.
        let onMenuItemClick = function (chosenComponent) {
            eventbus.publish("changeComponentEvent", chosenComponent.component);
            currentComponent(chosenComponent.component);
        }

        // The brand logo click callback.
        let onLogoClick = function () {
            eventbus.publish("changeComponentEvent", "home");
            currentComponent("home");
        }

        // Expose the proprieties needed by the UI.
        return {
            title: 'SOVA',
            menuItems,
            onMenuItemClick,
            onLogoClick,
            currentComponent,
        }
    }
});